package com.sk.weichat.bean.redpacket;

import android.os.Parcel;
import android.os.Parcelable;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * @author lzs
 * @date 2019/10/10
 * Email:343067508@qq.com
 **/
public class RedpacketDetailBean implements Parcelable {
    //红包状态：0：未领取 1 ：已领取 2：已领完 -1：已退款 （已过期）4 已过期（发送红包72小时后）
    public static final int Status_unopen = 0;
    public static final int Status_opened = 1;
    public static final int Status_empty = 2;
    public static final int Status_refunded = -1;
    public static final int Status_expire = 4;

    public static final int type_nomal = 1;//普通红包
    public static final int type_random = 2;//拼手气

    public static final String RedpacketDetailBean_Key = "RedpacketDetailBean_Key";
    public static final String RedpacketDetailBean_Status_Key = "RedpacketDetailBean_Status_Key";

    /**
     * id : ae109a3ef89d4c91b6e20b6f3b2ea9a4
     * sendTime : 1569477851
     * endTime : 1569487851
     * userId : 10000010
     * nickname : 等一会
     * greetings : 恭喜发财，大吉大利
     * type : 1
     * count : 2
     * receiveCount : 2
     * status : 5
     * money : 100
     * receiveMoney : 51
     * receiveMoneyTotal : 100
     * roomId : 5d8c53f657cd0e1b8022d17f
     * roomName : 谢丹、测试顶顶顶、等一会
     * toUserId : 0
     * toUserName :
     * receiveList : [{"id":"5d8c53f657cd0e1b8012d17f","redId":"ae109a3ef89d4c91b6e20b6f3b2ea9a4","receiveTime":1569477851,"nickname":"测试05","isMost":1,"receiveMoney":51,"userId":10000011},{"id":"5d8c53f657cd0e1b8032d17f","redId":"ae109a3ef89d4c91b6e20b6f3b2ea9a4","receiveTime":1569477851,"nickname":"测试06","isMost":0,"receiveMoney":49,"userId":10000012}]
     */

    private String id = "";
    private int sendTime;
    private int endTime;
    private int userId;
    private String nickname = "";
    private String greetings = "";
    private int type;//红包类型:1：普通红包 2：拼手气红包
    private int count;
    private int receiveCount;
    private int status;
    private float money;
    private float receiveMoney;
    private int receiveMoneyTotal;
    private String roomId = "";
    private String roomName = "";
    private int toUserId;
    private String toUserName = "";
    private List<ReceiveListBean> receiveList = new ArrayList<>();

    public RedpacketDetailBean() {
    }

    protected RedpacketDetailBean(Parcel in) {
        id = in.readString();
        sendTime = in.readInt();
        endTime = in.readInt();
        userId = in.readInt();
        nickname = in.readString();
        greetings = in.readString();
        type = in.readInt();
        count = in.readInt();
        receiveCount = in.readInt();
        status = in.readInt();
        money = in.readFloat();
        receiveMoney = in.readFloat();
        receiveMoneyTotal = in.readInt();
        roomId = in.readString();
        roomName = in.readString();
        toUserId = in.readInt();
        toUserName = in.readString();
        receiveList = in.createTypedArrayList(ReceiveListBean.CREATOR);
    }

    public static final Creator<RedpacketDetailBean> CREATOR = new Creator<RedpacketDetailBean>() {
        @Override
        public RedpacketDetailBean createFromParcel(Parcel in) {
            return new RedpacketDetailBean(in);
        }

        @Override
        public RedpacketDetailBean[] newArray(int size) {
            return new RedpacketDetailBean[size];
        }
    };

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getSendTime() {
        return sendTime;
    }

    public void setSendTime(int sendTime) {
        this.sendTime = sendTime;
    }

    public int getEndTime() {
        return endTime;
    }

    public void setEndTime(int endTime) {
        this.endTime = endTime;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getGreetings() {
        return greetings;
    }

    public void setGreetings(String greetings) {
        this.greetings = greetings;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getReceiveCount() {
        return receiveCount;
    }

    public void setReceiveCount(int receiveCount) {
        this.receiveCount = receiveCount;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public float getMoney() {
        return money;
    }

    public void setMoney(float money) {
        this.money = money;
    }


    public float getReceiveMoney() {
        return receiveMoney;
    }

    public void setReceiveMoney(float receiveMoney) {
        this.receiveMoney = receiveMoney;
    }

    public int getReceiveMoneyTotal() {
        return receiveMoneyTotal;
    }

    public void setReceiveMoneyTotal(int receiveMoneyTotal) {
        this.receiveMoneyTotal = receiveMoneyTotal;
    }

    public String getRoomId() {
        return roomId;
    }

    public void setRoomId(String roomId) {
        this.roomId = roomId;
    }

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public int getToUserId() {
        return toUserId;
    }

    public void setToUserId(int toUserId) {
        this.toUserId = toUserId;
    }

    public String getToUserName() {
        return toUserName;
    }

    public void setToUserName(String toUserName) {
        this.toUserName = toUserName;
    }

    public List<ReceiveListBean> getReceiveList() {
        return receiveList;
    }

    public void setReceiveList(List<ReceiveListBean> receiveList) {
        this.receiveList = receiveList;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeInt(sendTime);
        dest.writeInt(endTime);
        dest.writeInt(userId);
        dest.writeString(nickname);
        dest.writeString(greetings);
        dest.writeInt(type);
        dest.writeInt(count);
        dest.writeInt(receiveCount);
        dest.writeInt(status);
        dest.writeFloat(money);
        dest.writeFloat(receiveMoney);
        dest.writeInt(receiveMoneyTotal);
        dest.writeString(roomId);
        dest.writeString(roomName);
        dest.writeInt(toUserId);
        dest.writeString(toUserName);
        dest.writeTypedList(receiveList);
    }

    public static class ReceiveListBean implements Parcelable {
        /**
         * id : 5d8c53f657cd0e1b8012d17f
         * redId : ae109a3ef89d4c91b6e20b6f3b2ea9a4
         * receiveTime : 1569477851
         * nickname : 测试05
         * isMost : 1
         * receiveMoney : 51
         * userId : 10000011
         */

        private String id = "";
        private String redId = "";
        private long receiveTime;
        private String nickname = "";
        private int isMost;
        private float receiveMoney;
        private int userId;

        public ReceiveListBean(){
        }
        protected ReceiveListBean(Parcel in) {
            id = in.readString();
            redId = in.readString();
            receiveTime = in.readLong();
            nickname = in.readString();
            isMost = in.readInt();
            receiveMoney = in.readFloat();
            userId = in.readInt();
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(id);
            dest.writeString(redId);
            dest.writeLong(receiveTime);
            dest.writeString(nickname);
            dest.writeInt(isMost);
            dest.writeFloat(receiveMoney);
            dest.writeInt(userId);
        }

        @Override
        public int describeContents() {
            return 0;
        }

        public static final Creator<ReceiveListBean> CREATOR = new Creator<ReceiveListBean>() {
            @Override
            public ReceiveListBean createFromParcel(Parcel in) {
                return new ReceiveListBean(in);
            }

            @Override
            public ReceiveListBean[] newArray(int size) {
                return new ReceiveListBean[size];
            }
        };

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getRedId() {
            return redId;
        }

        public void setRedId(String redId) {
            this.redId = redId;
        }

        public long getReceiveTime() {
            return receiveTime;
        }

        public void setReceiveTime(long receiveTime) {
            this.receiveTime = receiveTime;
        }

        public String getNickname() {
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        public int getIsMost() {
            return isMost;
        }

        public void setIsMost(int isMost) {
            this.isMost = isMost;
        }

        public float getReceiveMoney() {
            return receiveMoney;
        }

        public void setReceiveMoney(float receiveMoney) {
            this.receiveMoney = receiveMoney;
        }

        public int getUserId() {
            return userId;
        }

        public void setUserId(int userId) {
            this.userId = userId;
        }
    }
}
